export const openFolderDialogApi = () => new Promise((resolve, reject) => {
    window.electronAPI.openFolderDialog().then(resolve).catch(reject)
})

export const readDirApi = (path) => new Promise((resolve, reject) => {
    window.electronAPI.readDir(path).then(resolve).catch(reject)
})

export const renameFileOrDirApi = (oldPath, newName) => new Promise((resolve, reject) => {
    window.electronAPI.renameFileOrDir(oldPath, newName).then(resolve).catch(reject);
});

export const readTextFileApi = (filePath) => new Promise((resolve, reject) => {
    window.electronAPI.readTextFile(filePath).then(resolve).catch(reject);
});

export const writeTextFileApi = (filePath, content) => new Promise((resolve, reject) => {
    window.electronAPI.writeTextFile(filePath, content).then(resolve).catch(reject);
});

export const deleteFileOrDirApi = (filePath) => new Promise((resolve, reject) => {
    window.electronAPI.deleteFileOrDir(filePath).then(resolve).catch(reject);
});

export const createDirectoryApi = (dirPath) => new Promise((resolve, reject) => {
    window.electronAPI.createDirectory(dirPath).then(resolve).catch(reject);
});

export const moveFileOrDirApi = (sourcePath, targetPath) => new Promise((resolve, reject) => {
    window.electronAPI.moveFileOrDir(sourcePath, targetPath).then(resolve).catch(reject);
});
